<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="<%=basePath %>leyuiyc/css/font.css">
        <link rel="stylesheet" href="<%=basePath %>leyuiyc/css/xadmin.css">
        <script src="<%=basePath %>leyuiyc/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="<%=basePath %>leyuiyc/js/xadmin.js"></script>
		<style>
		    /* body{overflow-y: scroll;} */ /* 禁止刷新后出现横向滚动条 */
		    /* .layui-table-body .layui-table,.layui-table-header .layui-table{width: 100%;}
			.layui-table-body.layui-table-main .layui-table-cell,.layui-table-header .layui-table-cell{white-space: pre-wrap;word-wrap: break-word; word-break: break-all; height: auto;} */
		</style>
        <script src="<%=basePath %>leyuiyc/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="<%=basePath %>leyuiyc/js/xadmin.js"></script>
		
    </head>
    
    <body>
        
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userId" placeholder="请输入用户id" autocomplete="off" class="layui-input"></div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userName" placeholder="请输入用户名" autocomplete="off" class="layui-input"></div>
                                <div class="layui-input-inline layui-show-xs-block" >
                                    <select name="orderState">
                                        <option value="">订单状态</option>
                                        <option value="10">待确认</option>
                                        <option value="20">已确认</option>
                                        <option value="30">已配货</option>
                                        <option value="40">已发货</option>
                                        <option value="50">已收款</option>
                                        <option value="0">已取消</option>
                                        <option value="60">已退货</option></select>
                                </div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userCardNumber" placeholder="会员卡号" autocomplete="off" class="layui-input"></div>
                                 <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="receiverPhone" placeholder="收货人电话" autocomplete="off" class="layui-input"></div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="下单日期" name="start" placeholder="yyyy-MM-dd HH:mm:ss" id="start">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="截止日期" name="end" placeholder="yyyy-MM-dd HH:mm:ss" id="end">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
				  					<input class="layui-input" id="condition" type="hidden" name="condition" value="40"/>
				  				</div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="orderSn" placeholder="订单号" autocomplete="off" class="layui-input"></div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form" id="test" lay-filter="test">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    
    
    <script>
			layui.use(['table','form','jquery','laydate'], function(){
			  var table = layui.table,
			  laydate = layui.laydate,
			  form = layui.form ;
			  //执行一个laydate实例
		        laydate.render({
		          elem: '#start' //指定元素
		          ,type: 'datetime'
		        });
		
		        //执行一个laydate实例
		        laydate.render({
		          elem: '#end' //指定元素
		          ,type: 'datetime'
		        });
			  table.render({
			    elem: '#test'
			    ,url:'selectOrder.do'
			    ,width: 'auto'
			    ,height: 700
			    ,method: 'post'
			    ,toolbar: true
			    ,title: '订单信息表'
			    ,totalRow: true
			    ,page: true
			    ,cols: [[
			      {type:'checkbox', fixed: 'left'}
			      ,{field:'orderSn', width:130, title: '订单编号', sort: true, fixed: 'left'}
			      ,{field:'userId', width:80, title: '用户id'}
			      ,{field:'userName', width:80, title: '用户姓名'}
			      ,{field:'userCardNumber', width:80, title: '用户卡号'}
			      ,{field:'addTime', width: 130, title: '订单生成时间'}
			      ,{field:'finishTime', width:130, title: '订单完成时间', sort: true}
			      ,{field:'paySn', width:80, title: '支付单号'}
			      ,{field:'arrivedAmount', width:90, title: '积分抵金额'}
			      ,{field:'goodsAmount', width:90, title: '商品总价格'}
			      ,{field:'shippingFee', width: 80, title: '订单信息'}
			      ,{field:'orderState', width:80, title: '订单状态' ,templet:'#state'}
			      ,{field:'orderMsg', width:80, title: '订单运费', sort: true}
			      ,{field:'orderAmount', width:80, title: '订单总价格'}
			      ,{field:'integralHandsel', width:100, title: '订单赠送积分(0表示不赠送)'}
			      ,{field:'servicePointId', width: 120, title: '配送服务点'}
			      ,{field:'shippingTime', width:80, title: '配送时间', sort: true}
			      ,{field:'deliverExplain', width:80, title: '发货备注'}
			      ,{field:'receiverName', width:80, title: '收货人姓名'}
			      ,{field:'receiverAddress', width:80, title: '收货地址'}
			      ,{field:'receiverPhone', width:110, title: '收货人电话'}
			      ,{field:'receiveProvinceId', width: 80, title: '收货人所在省'}
			      ,{field:'receiveCityId', width: 80, title: '收货人所在市'}
			      ,{field:'deliveryTime', width:80, title: '送货时间段'}
			      ,{field:'receiptMethod', width:80, title: '收货方式',templet:'#receiptMethod'}
			      ,{field:'isExperie', width:80, title: '订单类型'}
			      ,{field:'payMethod', width:80, title: '支付方式'}
			      ,{field:'isReturngoods', width:100, title: '订单是否有退货商品'}
			      ,{field:'', width:200, title: '操作', fixed: 'right',toolbar:'#operation'}
			    ]]
			    ,even:true
			    ,skin: 'row' //表格风格
                ,limits:[10,20,30,40,50]
			    ,limit: 20 //每页默认显示的数量
			  });
			  //数据筛选
		        form.on('submit(search)',function(data){
		            //执行重载
		            table.reload('test', {
		                where:data.field,
		                	page : {
								curr : 1 //从第一开始查看
						}
		            });
		            return false;
		        });
		       
			});
			
	</script>
	<script type="text/html" id="state">	
	   {{#  if(d.orderState == "0") {  }}
			<font color="#00ff00">已取消</font>
		{{#  } else if(d.orderState == "10") {  }}
			<font color="#ff0000">待确认</font>
         {{#  } else if(d.orderState == "20") {  }}
			<font color="#ff0000">已确认</font>
		{{#  } else if(d.orderState == "30") {  }}
			<font color="#ff0000">已配货</font>
		{{#  } else if(d.orderState == "40") {  }}
			<font color="#ff0000">已发货</font>
		{{#  } else if(d.orderState == "50") {  }}
			<div><font color="#ff0000">已收款</font></div>
		{{#  } else if(d.orderState == "60") {  }}
			<font color="#ff0000">已退货</font>
		{{#  }  }}
    </script>
    <script type="text/html" id="receiptMethod">	
	   {{#  if(d.receiptMethod == "0") {  }}
			<font color="#99CC66">上门送</font>
		{{#  } else if(d.receiptMethod == "1") {  }}
			<font color="#00FF00">自取</font>
		{{#  }  }}
    </script>
    <script type="text/html" id="operation">	
	   <button type="button" class="layui-btn layui-btn-normal">订单发货</button>
	   <button type="button" class="layui-btn layui-btn-danger">取消订单</button>
    </script>
   

</html>